using System;
using System.Collections;

namespace flickr.api
{
    [Serializable]
    public class PhotoCollection : ArrayList
    {
        public PhotoCollection() : base(){}

        public PhotoCollection(Photo[] photos) : this()
        {
            AddRange(photos);
        }
	
        public new Photo this[int index]
        {
            get { return (Photo)base[index]; }
            set { base[index] = value; }
        }

        public void AddRange(PhotoCollection collection)
        {
            AddRange(collection.ToArray());
        }

        public void AddRange(Photo[] array)
        {
            foreach(Photo photo in array)
            {
                Add(photo);
            }
        }

        public static implicit operator Photo[](PhotoCollection collection)
        {
            Photo[] photos = new Photo[collection.Count];
            collection.CopyTo(photos, 0);
            return photos;
        }

        public static implicit operator PhotoCollection(Photo[] photos)
        {
            return new PhotoCollection(photos);
        }
    }
}